
use -- the proper database below according to the current environment
    Events
 -- Test_Events
 -- Live_Events

GO
/****** Object:  StoredProcedure [dbo].[spGetIncidentsByCompanyIds2]    Script Date: 12/15/2017 5:51:03 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


ALTER PROCEDURE [dbo].[spGetEventIndicatorTemplates]
AS
BEGIN
	SELECT	dbo.BaseEventIndicators.Id, 
			dbo.BaseEventIndicators.Name, 
			dbo.BaseEventIndicators.Number, 
			dbo.BaseEventIndicators.SortKey, 
			dbo.BaseEventIndicators.ControversyIndicatorId, 
			dbo.ControversyIndicators.Name AS ControversyIndicatorName, 
			dbo.ControversyIndicators.Number AS ControversyIndicatorNumber, 
			dbo.ControversyIndicators.SortKey AS ControversyIndicatorSortKey
	FROM    dbo.BaseEventIndicators 
	INNER JOIN dbo.ControversyIndicators ON dbo.BaseEventIndicators.ControversyIndicatorId = dbo.ControversyIndicators.Id
	WHERE dbo.BaseEventIndicators.UnavailableToClients = 0
	ORDER BY ControversyIndicatorSortKey, dbo.BaseEventIndicators.SortKey
END


GO

